import getState from "@/api/state";
import InsuranceType from "@/template/InsuranceType/InsuranceType";
import React from "react";
import { useEffect } from "react";
import { useState } from "react";

const Home8 = ({ condition }) => {
    const [message, setMessage] = useState("暂无数据");
    const [loading, setLoading] = useState(false)
    const [state, setState] = useState({
        data: [
            // {
            //     color: "rgb(73,146,255)",
            //     name: "车险",
            //     value: 12,//数字类型
            // },
            // {
            //     color: "rgb(124,255,178)",
            //     name: "意健险",
            //     value: 43
            // },

            // {
            //     color: "rgb(46,136,255)",//进度条颜色
            //     value: 98,
            //     name: "财产险"
            // },
            // {
            //     color: "rgb(87,48,233)",//进度条颜色
            //     value: 44,
            //     name: "共保业务"
            // },

        ]
    })

    useEffect(() => {
        getState({
            apiUrl: "/cifgp-core-api/synt/monthAndYear",
            state,
            condition: { ...condition, cType: "syntriskDistribution" },
            setState,
            setLoading,
            setMessage
        })
    }, [condition])

    return (
        <>

            {/* 险种分布情况 */}

            <InsuranceType
                message={message}
                loading={loading}
                style={{ width: "30%" }}
                ItemHeight="50%"
                title="险种分布情况"
                hideBtn
                data={[state]}
                unit="客户量"
                fieldNames={{
                    name: "",
                    value: "个"
                }}
            />
        </>
    )
}

export default Home8;